using System;
using System.IO;
using System.Windows.Media;
using Intuipic.Interop;

namespace Intuipic.Data
{
	/// <summary>
	/// Provides a concrete base class of <see cref="DirectoryInformationBase"/> that is used to represent directories.
	/// </summary>
	public sealed class DirectoryInformation : DirectoryInformationBase
	{
		private static readonly ImageSource _closedIcon;
		private static readonly ImageSource _openIcon;

		static DirectoryInformation()
		{
			try
			{
				_closedIcon = IconHelper.GetIcon("name", FileInfoAttributes.Directory, FileInfoFlags.Icon | FileInfoFlags.SmallIcon | FileInfoFlags.UseFileAttributes);
				_openIcon = IconHelper.GetIcon("name", FileInfoAttributes.Directory, FileInfoFlags.Icon | FileInfoFlags.SmallIcon | FileInfoFlags.UseFileAttributes | FileInfoFlags.OpenIcon);
			}
			catch
			{
				//if we can't load icons for any reason, who cares - just don't display them
			}
		}

		public DirectoryInformation(InformationBase parent, DirectoryInfo directoryInfo)
			: base(_closedIcon, _openIcon, parent, directoryInfo)
		{
		}
	}
}
